<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="img/favicon.png">
    <link rel="stylesheet" href="css/index.css">
    <title>Document</title>
</head>

<body>
    <div id="app" class="container selected1">
        <div class="list-header flex">
            <a href="index.html"><img src="img/list/icon-home.png" alt=""></a>
            <form action="" class="flex">
                <div class="inner flex">
                    <input type="text" placeholder="Web前端">
                    <span>&times;</span>
                </div>
                <button>搜索</button>
            </form>
        </div>


        <div class="filter">
            <ul>
                <li v-for="item in filters">{{item.name}}</li> <!-- class="active" -->
            </ul>
        </div>

        <div class="filter-content selected1">
            <div class="scroller">
                <ul>
                    <li class="filter-li selected">
                        <!--  selected -->
                        <ul>
                            <li><a href="javascript:;" v-for="option in filters">{{option.options.text}}</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>


        <div>
            <ul class="job-list">
                <li v-for="item in jobs">
                    <a :href="item.href" class="flex">
                        <img :src="item.logo" alt="">
                        <div class="text">
                            <div class="title">
                                <h4>
                                    <span>{{item.title}}</span>
                                </h4>
                                <span class="salary">{{item.salary}}</span>
                            </div>
                            <div class="name">{{item.company}}</div>
                            <div class="msg">
                                <em v-for="tag in item.tags">{{tag}}</em>
                            </div>
                        </div>
                    </a>
                </li>
            </ul>
        </div>
    </div>

    <script src="js/vue.js"></script>
    <script>
        const vm = new Vue({
            el: '#app',
            data: {
                filters: [],
                jobs: []
            },
            created: function () {
                fetch('http://127.0.0.1:5500/api/filters.json')
                    .then(function (res) {
                        return res.json();
                    })
                    .then(function (data) {
                        vm.filters = data
                    })

                fetch('http://127.0.0.1:5500/api/jobs.json')
                    .then(function (res) {
                        return res.json();
                    })
                    .then(function (data) {
                        console.log(data);
                        vm.jobs = data
                    })
            }
        })
    </script>
</body>

</html>